#!/usr/bin/python
# Filename: using_file.py

poem = '''\
Programming is fun
When the work is done
if you wanna make your work also fun:
    use Python!
'''

_f = open('poem.txt', 'w') # open for 'w'riting
_f.write(poem) # write text to file
_f.close() # close the file

_f = open('poem.txt') # if no mode is specified, 'r'ead mode is assumed by default
while True:
    line = _f.readline()
    if len(line) == 0: # Zero length indicates EOF
        break
    print(line, end='')
_f.close() # close the file

